
/*---------------*/
/* Joseph Porter */
/* Summer of 2012*/
/* Team 1247     */
/*www.ROKSBOT.com*/
/* RangeFinder   */
/*---------------*/
package Team1247Classes.Sensors;

import edu.wpi.first.wpilibj.AnalogChannel;

public class RangeFinder {
    private int analogChannel;
    private AnalogChannel distanceSensor;
    private double analogValue;
    private double distance;
    private final double VOLTS_PER_INCH = 9.2;
    public RangeFinder(int analogChannel){
        this.analogChannel = analogChannel;
        this.distanceSensor = new AnalogChannel(this.analogChannel);
        
    }
    public double getDistance(){
        this.analogValue = distanceSensor.getAverageVoltage();
        this.distance = Math.floor(this.analogValue/VOLTS_PER_INCH);
        return this.distance;
    }
    public double getRawVoltage(){
        this.distance = Math.floor(distanceSensor.getAverageVoltage());
        return this.distance;
    }
}
